package com.huatai.common.utils;

import org.apache.commons.lang3.StringUtils;

public class ValidateUtils {

	public static boolean checkIsCorrectDateStr(String dateStr, String formate) {
		if (StringUtils.isBlank(dateStr) || StringUtils.isBlank(formate))
			return false;
		if ("yyyy-MM-dd".equals(formate)) {
			String dateExpress = "^((?!0000)[0-9]{4}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)"
					+ "|(0[13578]|1[02])-31)|([0-9]{2}(0[48]|[2468][048]|[13579][26])|(0[48]|[2468][048]"
					+ "|[13579][26])00)-02-29)$";
			if (!dateStr.matches(dateExpress)) {
				return false;
			}
		} else {
			return false;
		}
		return true;
	}

}
